							*=================================================*
							* Economic Interventions, Evaluations and Trust   *
							* Devine/Turnbull-Dugarte						  *
							*=================================================*

							
cd "/Users/stuartturnbulldugarte/Dropbox/Interventions & Trust/PSRM_replication"							
use "/Users/stuartturnbulldugarte/Dropbox/Interventions & Trust/PSRM_replication/eb75.3_2011.dta", clear

													***************
													**  Cleaning **
													***************
													

drop if v6 == 33 | v6 == 31 | v6 == 35 | v6 == 43 | v6 == 34 // drop non-EU countries.
replace v6 = 4 if v6 == 14 // merge East/West DE
replace v6 = 9 if v6 == 10 // merge GB/NI

keep if v6 == 13 // keep if Portugal

gen treated = 1 if v651 > 11 // keep if interviewed after intervention date (i.e treated)
replace treated = 0 if v651 < 12
tab treated

recode v310 (2=0) (1=1), generate (trust_govt) // trust govt
recode v311 (2=0) (1=1), generate (trust_plt) // trust parliament
recode v312 (2=0) (1=1), generate (trust_eu) // trust eu

tab trust_plt treated, col nofreq

gen placebo = 1 if v651 >= 7 // median of the control group, including treated
replace placebo = 0 if v651 <7

gen placebo2 = 1 if v651 >= 7 & treated !=1 // median of control group, excluding treated
replace placebo2 = 0 if v651 < 7 & treated !=1

gen placebo3 = 1 if v651 >= 6 & treated !=1 // 6th day, excluding treated
replace placebo3 = 0 if v651 < 6 & treated !=1

gen placebo4 = 1 if v651 >= 5 & treated !=1 // 5th day, excluding treated
replace placebo4 = 0 if v651 < 5 & treated !=1

rename v651 day // day of interview

rename v709 region // region of portugal

/* Variables are recoded so that positive coefficients would equal positive effect on evaluations */

recode v140 (1=4) (2=3) (3=2) (4=1), gen(econ_index) /* variable summarises answers to v127/140. As from the documentation:
						Respondents coded 1 or 2 in V114 or V120 and coded 1 in V127 or V134 are coded 1 ("Satisfied and confident") in the index variable. 
						Respondents coded 3 or 4 in V114 or V120 and coded 1 in V127 or V134 are coded 2 ("Unsatisfied and confident") in the index variable. 
						Respondents coded 1 or 2 in V114 or V120 and coded 2 in V127 or V134 are coded 3 ("Satisfied and worried") in the index variable. 
						Respondents coded 3 or 4 in V114 or V120 and coded 2 in V127 or V134 are coded 4 ("Unsatisfied and worried") in the index variable. 
						Respondents coded 5 in V114 or V120 or coded 3 or 4 in V127 or V134 are coded 5 ("INAP") in the index variable. */

recode v127 (1=3) (2=1) (3=2), gen(econ_expec) /* What are your expectations for the next twelve months: will the next twelve months be better, worse or the same, when it comes to...?
												The economic situation in [Our Country]. 1 = better, 2 = worse, 3 = same, 4 = DK */

recode v114 (1=4) (2=3) (3=2) (4=1), gen(econ_evals) /* How would you judge the current situation in each of the following?
						The situation of the [nationality] economy? 1= VG 2= Rather G 3= RB 4= VB 5 = DK */

rename v616 age
rename v614 education
rename v752 occupation
rename v615 gender

label variable treated "Treatment"
label define treated 0 "Control" 1 "Treated"
label values treated treated

label variable age "Age (years)"
label variable education "Education"
label variable occupation "Occupation"

gen running = day - 11


													*****************
													***  FIGURE 1 ***
													*****************
													
													
																						
reg trust_plt i.treated i.education age i.occupation gender, r 
estimates store m1
reg econ_evals i.treated i.education age i.occupation gender, r
estimates store econ1
reg econ_expec i.treated i.education age i.occupation gender, r
estimates store econ3
coefplot (m1, msymbol(circle) mlabel("Trust in Parliament (0/1)") mlabposition(12)) (econ1, msymbol(diamond) mlabel("Economic evaluations (1-4)") mlabposition(12)) ///
(econ3, msymbol(triangle) mlabel("Economic expectations (1-3)") mlabposition(12)), ///
		keep(*.treated) xline(0, lcolor(black)) ylabel("") xtitle("Marginal effect of intervention") ///
		legend(off) levels(99 95) note("Confidence intervals at 99% and 95%", size(small) position(5)) scheme(538w) legend(position(6) rows(2))
graph save Figure1.gph, replace
graph export Figure1.pdf, replace		
**********************************APPENDIX MATERIAL**********************************

													******************
													***  TABLE A1 ****
													******************

sutex trust_plt treated education age occupation gender econ_eval econ_expec econ_index region, minmax file(TableA1.tex)

													******************
													**  TABLE A2-3  **													
													******************
													
by treated, sort : sutex trust_plt treated education age occupation gender econ_eval econ_expec econ_index region, minmax file(TableA2-A3.tex)
	
													
													******************
													***  TABLE A4 ****													
													******************
latab  treated

													******************
													***  FIGURE A1 ***
													******************

hist day, frequency xline(11, lcolor(red)) xtitle("Day of interview") ytitle("Number of respondents") w(1) fcolor(gs10*0.5) 
graph save FigureA1.gph, replace
graph export FigureA1.pdf, replace
													******************
													***  FIGURE A2 ***
													******************

preserve
collapse (mean) trust_plt econ_evals econ_expec, by(day)

twoway line trust_plt day, xline(11, lcolor(red)) xtitle("Day of interview") ytitle("% trust parliament") legend(off) || lfit trust_plt day if day <=11 || lfit trust_plt day if day >=11, saving(trustday, replace)

twoway line econ_evals day, xline(11, lcolor(red)) xtitle("Day of interview") ytitle("Econ evaluations") legend(off) || lfit econ_evals day if day <=11 || lfit econ_evals day if day >=11, saving(evalsday, replace)

twoway line econ_expec day, xline(11, lcolor(red)) xtitle("Day of interview") ytitle("Econ expectations") legend(off) || lfit econ_expec day if day <=11 || lfit econ_expec day if day >=11, saving(expecday, replace)

gr combine trustday.gph evalsday.gph expecday.gph
graph save FigureA2.gph, replace
graph export FigureA2.pdf, replace
restore


													******************
													***  FIGURE A3 ***
													******************
													
													
twoway (lpolyci trust_plt day if day <=12) (lpolyci trust_plt day if day >=12, legend(off) xline(12,lpattern(dash)))  (hist day, blcolor(gs10%30) fcolor(gs10%30) discrete percent legend(off) yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 " " 20 " " 40 " " 60 " " 80 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small) tl(0)))
gr save poly1.gph
twoway (lpolyci econ_evals day if day <=12) (lpolyci econ_evals day if day >=12, legend(off) xline(12,lpattern(dash)))  (hist day, blcolor(gs10%30) fcolor(gs10%30) discrete percent legend(off) yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 " " 20 " " 40 " " 60 " " 80 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small) tl(0)))
gr save poly2.gph
twoway (lpolyci econ_expec day if day <=12) (lpolyci econ_expec day if day >=12, legend(off) xline(12,lpattern(dash)) ytitle(Test))  (hist day, blcolor(gs10%30) fcolor(gs10%30) discrete percent legend(off) yaxis(2) yscale(alt lcolor() axis(2)) ytitle("") ylabel(0 " " 20 " " 40 " " 60 " " 80 " " 100 " ", labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small) tl(0)))
gr save poly3.gph
gr combine poly1.gph poly2.gph poly3.gph
graph save FigureA3.gph, replace
graph export FigureA3.pdf, replace

													******************
													***  FIGURE A4 ***
													******************

//Balance of treatmeant assignment
logit treated i.education age i.occupation i.gender
coefplot, xline(0) drop(_cons) xtitle("Coefficient") ytitle("Variable")
graph save FigureA4.gph, replace
graph export FigureA4.pdf, replace


													******************
													***  FIGURE A5 ***
													******************


reg trust_plt i.treated i.education age i.occupation if gender == 1, r 
estimates store plt_men

reg trust_plt i.treated i.education age i.occupation if  gender == 2, r 
est store plt_women

reg econ_evals i.treated education age occupation if gender == 1
margins, dydx(*) post
est store evals_men

reg econ_evals i.treated education age occupation if gender == 2
margins, dydx(*) post
est store evals_women

reg econ_expec i.treated education age occupation if gender == 1
margins, dydx(*) post
est store expec_men

reg econ_expec i.treated education age occupation if gender == 2
margins, dydx(*) post
est store expec_women

coefplot plt_men plt_women evals_men evals_women expec_men expec_women, ///
		keep(*.treated) xline(0) xtitle("Marginal Effect of Intervention") ///
		levels(99 95) ylabel("") note("Confidence intervals at 99% and 95%", size(small) position(5)) ///
		plotlabels("Trust Parliament (Men)" "Trust Parliament (Women)" "Evaluations (Men)" "Evaluations (Women)" ///
		"Expectations (Men)" "Expectations (Women)") legend(position(6) rows(2))
graph save FigureA5.gph, replace
graph export FigureA5.pdf, replace
		

													******************
													***  TABLE A5 ***
													******************

reg trust_plt i.treated i.education age i.occupation gender, r 
estimates store m1
* Government
reg trust_govt i.treated i.education age i.occupation gender, r  // not significant
estimates store m2
* EU
reg trust_eu i.treated i.education age i.occupation gender, r   // not significant
estimates store m3
** Robustness: Regional effect
reg trust_plt i.treated i.education age i.occupation gender i.region, r  // no regions significant
estimates store m4

esttab m1 m2 m3 m4 using TableA5.tex, replace se scalars(bic) label booktabs nobaselevels star(+ 0.10 * 0.05 ** 0.01 *** 0.001) ///
mtitles("Parliament" "Government" "European Union" "With Region FE") ///
order (1.treated gender *.education age *.occupation) ///
coeflabels(1.treated "Treated" gender "Gender" 2.education "15 years" 3.education "16 years" 4.education "17 years"  5.education "18 years" 6.education "19 years" 7.education "20 years" ///
8.education "21 years" 9.education "22+ years" 10.education "Still studying" 11.education "No full-time education" age "Age" ///
2.occupation "Managers" 3.occupation "Other white collar" 4.occupation "Manual workers" 5.occupation "House persons" 6.occupation "Unemployed" 7.occupation "Retired") ///
 indicate("Region Fixed Effect = *.region", labels("\checkmark" "")) ///
title(Results of the intervention on trust in Parliament, Government and the EU (Average Marginal Effects Reported) \label{tab:results1}) 

													******************
													***  TABLE A6 ***
													******************

esttab  m1 econ1 econ3 using TableA6.tex, replace se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) label booktabs nobaselevels ///
mtitles ("Trust in Parliament" "Evaluations" "Expectations") ///
order (1.treated gender *.education age *.occupation) ///
coeflabels(1.treated "Treated" gender "Gender" 2.education "15 years" 3.education "16 years" 4.education "17 years"  5.education "18 years" 6.education "19 years" 7.education "20 years" ///
8.education "21 years" 9.education "22+ years" 10.education "Still studying" 11.education "No full-time education" age "Age" ///
2.occupation "Managers" 3.occupation "Other white collar" 4.occupation "Manual workers" 5.occupation "House persons" 6.occupation "Unemployed" 7.occupation "Retired") ///
title(Main models as presented in figure \ref{fig:intervention_meff} (Average Marginal Effects Reported) \label{tab:main_mods})


													******************
													***  TABLE A7 ***
													******************

reg trust_plt i.placebo i.education age i.occupation gender i.region, r
estimates store pl1

reg trust_plt i.placebo2 i.education age i.occupation gender i.region, r
estimates store pl2

reg trust_plt i.placebo3 i.education age i.occupation gender i.region, r
estimates store pl3

reg trust_plt i.placebo4 i.education age i.occupation gender i.region, r
estimates store pl4

reg trust_plt i.treated i.education age i.occupation gender i.region if day >= 8 & day <= 14, r   // limited bandwith
estimates store pl5

* Table of placebos
esttab  pl1 pl2 pl3 pl4 pl5 using TableA7.tex, replace se star(+ 0.10 * 0.05 ** 0.01 *** 0.001) label booktabs nobaselevels ///
mtitles ("Median (with Treated)" "Median (without treated)" "6th Day" "5th day" "Reduced bandwidth") ///
order (1.placebo 1.placebo2 1.placebo3 1.placebo4 1.treated) ///
coeflabels(1.placebo "Placebo 1" 1.placebo2 "Placebo 2" 1.placebo3 "Placebo 3" 1.placebo4 "Placebo 4" 1.treated "Treated") ///
indicate("Region Fixed Effect = *.region", labels("\checkmark" "")) ///
title(Placebo Tests for Political Trust (Average Marginal Effects Reported) \label{tab:placebo_trust})


													******************
													***  FIGURE A6 ***
													******************

reg econ_evals i.placebo education age occupation gender
margins, dydx(*) post
estimates store evals_pl1

reg econ_evals i.placebo2 education age occupation gender
margins, dydx(*) post
estimates store evals_pl2

reg econ_evals i.placebo3 education age occupation gender
margins, dydx(*) post
estimates store evals_pl3

reg econ_evals i.placebo4 education age occupation gender
margins, dydx(*) post
estimates store evals_pl4

reg econ_evals i.treated education age occupation gender if day >= 8 & day <= 14 // limited bandwith
margins, dydx(*) post
estimates store evals_pl5

reg econ_index i.placebo education age occupation gender
margins, dydx(*) post
estimates store index_pl1

reg econ_index i.placebo2 education age occupation gender 
margins, dydx(*) post
estimates store index_pl2

reg econ_index i.placebo3 education age occupation gender
margins, dydx(*) post
estimates store index_pl3

reg econ_index i.placebo4 education age occupation gender
margins, dydx(*) post
estimates store index_pl4

reg econ_index i.treated education age occupation gender if day >= 8 & day <= 14 // limited bandwith
margins, dydx(*) post
estimates store index_pl5

reg econ_expec i.placebo education age occupation gender
margins, dydx(*) post
estimates store expec_pl1

reg econ_expec i.placebo2 education age occupation gender
margins, dydx(*) post
estimates store expec_pl2

reg econ_expec i.placebo3 education age occupation gender
margins, dydx(*) post
estimates store expec_pl3

reg econ_expec i.placebo4 education age occupation gender
margins, dydx(*) post
estimates store expec_pl4

reg econ_expec i.treated education age occupation gender if day >= 8 & day <= 14 // limited bandwith
margins, dydx(*) post
estimates store expec_pl5

coefplot (expec_pl*, label("Expectations")) (index_pl*, label("Index")) (evals_pl*, label("Evaluations")), ///
keep(*.placebo* *.treated) yline(0) bycoefs vertical xlabel("") ytitle("Marginal effect") ///
coeflabels(1.placebo = "Median Control (w/ Treated)" 1.placebo2 = "Median Control (w/o Treated)" ///
1.placebo3 = "6th Day" 1.placebo4 = "5th Day" 1.treated = "Reduced Bandwidth") legend(rows(1)) 
graph save FigureA6.gph, replace
graph export FigureA6.pdf, replace

													******************
													***  FIGURE A7 ***
													******************

ritest treated _b[treated], reps(1000) kdensityplot: logit trust_plt treated education age occupation gender if v6==13
gr save permutation.gph
ritest treated _b[treated], reps(1000) kdensityplot: reg econ_expec treated education age occupation gender if v6==13
gr save permutation2.gph
ritest treated _b[treated], reps(1000) kdensityplot: reg econ_evals  treated education age occupation gender if v6==13
gr save permutation3.gph

gr combine permutation.gph permutation2.gph permutation3.gph
graph save FigureA7.gph, replace
graph export FigureA7.pdf, replace

													******************
													***  FIGURE A8 ***
													******************
** Reload the data as previous version dropped portugal
													
use "/Users/stuartturnbulldugarte/Dropbox/Interventions & Trust/PSRM_replication/eb75.3_2011.dta", clear

** Rerun necessary data cleaning

drop if v6 == 33 | v6 == 31 | v6 == 35 | v6 == 43 | v6 == 34 // drop non-EU countries.
replace v6 = 4 if v6 == 14 // merge East/West DE
replace v6 = 9 if v6 == 10 // merge GB/NI

gen treated = 1 if v651 > 11 // keep if interviewed after intervention date (i.e treated)
replace treated = 0 if v651 < 12
tab treated

recode v311 (2=0) (1=1), generate (trust_plt) // trust parliament

recode v140 (1=4) (2=3) (3=2) (4=1), gen(econ_index) /* variable summarises answers to v127/140. As from the documentation:
						Respondents coded 1 or 2 in V114 or V120 and coded 1 in V127 or V134 are coded 1 ("Satisfied and confident") in the index variable. 
						Respondents coded 3 or 4 in V114 or V120 and coded 1 in V127 or V134 are coded 2 ("Unsatisfied and confident") in the index variable. 
						Respondents coded 1 or 2 in V114 or V120 and coded 2 in V127 or V134 are coded 3 ("Satisfied and worried") in the index variable. 
						Respondents coded 3 or 4 in V114 or V120 and coded 2 in V127 or V134 are coded 4 ("Unsatisfied and worried") in the index variable. 
						Respondents coded 5 in V114 or V120 or coded 3 or 4 in V127 or V134 are coded 5 ("INAP") in the index variable. */

recode v127 (1=3) (2=1) (3=2), gen(econ_expec) /* What are your expectations for the next twelve months: will the next twelve months be better, worse or the same, when it comes to...?
												The economic situation in [Our Country]. 1 = better, 2 = worse, 3 = same, 4 = DK */

recode v114 (1=4) (2=3) (3=2) (4=1), gen(econ_evals) /* How would you judge the current situation in each of the following?
						The situation of the [nationality] economy? 1= VG 2= Rather G 3= RB 4= VB 5 = DK */


rename v616 age
rename v614 education
rename v752 occupation
rename v615 gender

label variable treated "Treatment"
label define treated 0 "Control" 1 "Treated"
label values treated treated

label variable age "Age (years)"
label variable education "Education"
label variable occupation "Occupation"



  levelsof v6, local(levs)
 foreach n in `levs' {
display ""
display "======== Regression for level: `n' ========="
logit trust_plt i.treated education age occupation gender if v6 == `n'
estimates store cntry_plac_`n'
 }

 coefplot cntry_plac*, xline(0) xline(-0.368, lcolor(blue)) keep(1.treated) ylabel("") xtitle(" " "Coefficient") ///
 plotlabels("France" "Belgium" "The Netherlands" "Germany" "Italy" "Luxembourg" "Denmark" "Ireland" "Great Britain" ///
 "Greece" "Spain" "Portugal" "Finland" "Sweden" "Austria" "Cyprus" "Czech Republic" "Estonia" "Hungary" "Latvia" ///
 "Lithuania" "Malta" "Poland" "Slovakia" "Slovenia" "Bulgaria" "Romania" "Croatia") ///
 note("Portugese coefficient in blue dashed line. Zero in grey dashed line.", size(small) position(5)) legend(pos(9) col(1))
graph save FigureA8.gph, replace
graph export FigureA8.pdf, replace

 

 													******************
													***  FIGURE A9 ***
													******************
keep if v6 == 13 // keep if Portugal
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(1)
estimates store nneigh1
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(2)
estimates store nneigh2
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(3)
estimates store nneigh3
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(4)
estimates store nneigh4
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(5)
estimates store nneigh5
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(6)
estimates store nneigh6
teffects nnmatch (trust_plt age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(7)
estimates store nneigh7

coefplot nneigh*, xline(0) legend(position(6) rows(1) subtitle("N of Neighbours")) ylabel("") levels(95 90) ///
plotlabels("1" "2" "3" "4" "5" "6" "7") xtitle(" " "Coefficient") note("Confidence intervals at 99% and 95%", size(small) position(5)) 
graph save FigureA9.gph, replace
graph export FigureA9.pdf, replace


 
 													*******************
													***  FIGURE A10 ***
													*******************
													

teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(1)
estimates store nneigh1_econ
teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(2)
estimates store nneigh2_econ
teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(3)
estimates store nneigh3_econ
teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(4)
estimates store nneigh4_econ
teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(5)
estimates store nneigh5_econ
teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(6)
estimates store nneigh6_econ
teffects nnmatch (econ_expec age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(7)
estimates store nneigh7_econ

coefplot nneigh*_econ, xline(0) legend(position(6) rows(1) subtitle("N of Neighbours")) ylabel("") levels(95 90) ///
plotlabels("1" "2" "3" "4" "5" "6" "7") xtitle(" " "Coefficient") note("Confidence intervals at 99% and 95%", size(small) position(5)) 
graph save FigureA10.gph, replace
graph export FigureA10.pdf, replace

													
													 
 													*******************
													***  FIGURE A11 ***
													*******************
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(1)
estimates store nneigh1_econev
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(2)
estimates store nneigh2_econev
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(3)
estimates store nneigh3_econev
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(4)
estimates store nneigh4_econev
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(5)
estimates store nneigh5_econev
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(6)
estimates store nneigh6_econev
teffects nnmatch (econ_evals age education occupation gender) (treated), ematch(gender) biasadj(age education occupation) nneighbor(7)
estimates store nneigh7_econev

coefplot nneigh*_econev, xline(0) legend(position(6) rows(1) subtitle("N of Neighbours")) ylabel("") levels(95 90) ///
plotlabels("1" "2" "3" "4" "5" "6" "7") xtitle(" " "Coefficient") note("Confidence intervals at 99% and 95%", size(small) position(5)) 
graph save FigureA11.gph, replace
graph export FigureA11.pdf, replace

